package com.example.netlib;

import android.app.ProgressDialog;
import android.util.Log;

import com.szlanyou.thirdsdk.retrofit.callback.IFileUploadProgressHttpResultHandler;
import com.szlanyou.thirdsdk.retrofit.callback.IHttpResultHandler;

/**
 * @author 陈章
 * create at 2021/7/8 16:04
 * desc:统一处理结果进行打印(文件上传)
 */
public  class DefaultFileUploadHttpResultHandler<T> extends IFileUploadProgressHttpResultHandler<T> {
    private static final String TAG = "DefaultFileUploadHttpRe";
    protected ProgressDialog progressDialog;

    public void setProgressDialog(ProgressDialog progressDialog) {
        this.progressDialog = progressDialog;
    }

    @Override
    public void onStart(String requestPageFlag,String requestCode) {
        Log.d(TAG, "onStart: requestCode = " + requestCode);
    }

    @Override
    public void onSuccess(String requestPageFlag,String requestCode, T successBean) {
        Log.d(TAG, "onSuccess: requestCode = " + requestCode + ",successBean = " + successBean);
    }

    @Override
    public void onError(String requestPageFlag,String requestCode, Throwable e) {
        Log.e(TAG, "onError: requestCode = " + requestCode);
        e.printStackTrace();
    }

    @Override
    public void onFailure(String requestPageFlag,String requestCode, String responseCode, String msg) {
        Log.e(TAG, "onFailure: requestCode = " + requestCode + ",responseCode = " + responseCode + ",msg = " + msg);
    }

    @Override
    public void onCancel(String requestPageFlag,String requestCode) {
        Log.d(TAG, "onCancel: requestCode = " + requestCode);
    }

    @Override
    public void onComplete(boolean causeByError) {
        Log.d(TAG, "onComplete: ");
    }

    @Override
    public void onRequestProgress(String url, long bytesWritten, long contentLength) {
        Log.d(TAG, "onRequestProgress: url = " + url + ",bytesWritten = " + bytesWritten + ",contentLength = " + contentLength);
    }
}
